Add 30s init timeout and verify sync provider state#138
Merged
Conversation
This was referenced May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements #120 (init timeout) and #121 (verify sync init succeeded) — the first step of the 1.0-readiness workstream A.
initTimeout(default 30s) on bothbuildandbuildAsyncprivate helpers.setProviderAndWaitis wrapped with.disconnect.timeoutFail(TimeoutException(...))(initTimeout). The layer build fails fast instead of hanging on an unreachable / misconfigured provider.ScopesleepsinitTimeout, then atomically transitionsProviderStatus.NotReady/ErrortoFatalso callers pollingproviderStatusstop waiting. The fiber is interrupted when the layer is released.fromProvider(provider, evaluationTimeout, initTimeout)andfromProviderAsync(provider, evaluationTimeout, initTimeout)added for explicit control. All existing factories inherit the 30s default — no caller code needs to change.setProviderAndWaitreturns, the newverifyInitStatehelper reads the underlying provider's state.READY/STALEare accepted;ERROR/FATAL/NOT_READYcause the layer build to fail with anIllegalStateExceptionso misconfiguration surfaces at startup instead of at first evaluation.New cases in
core/src/test/scala/zio/openfeature/ProviderInitHardeningSpec.scala:fromProviderfails withTimeoutExceptionwhen init blocks pastinitTimeout.fromProviderfails withIllegalStateExceptionwhen provider reportsERRORafterinitialize().ProviderStatustoFatalafterinitTimeoutwhen init hangs.Closes #120
Closes #121